package com.hzyb.shopHotSearch.controller;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hzyb.shopHotSearch.service.ShopHotSearchService;

@RestController
@RequestMapping("/hotSearch")
public class ShopHotSearchController {

	private static final Logger LOGGER = LoggerFactory.getLogger(ShopHotSearchController.class);

	@Autowired
	private ShopHotSearchService ShopHotSearchService;

	@RequestMapping("/changeHotSearch")
	public Map<String, Object> changeHotSearch(@RequestParam String index){
		Map<String, Object> map=new HashMap<>();
		map.put("status", "fail");
		try {
			map.put("data",ShopHotSearchService.changeHotSearch(index));
			map.put("status", "success");
		} catch (Exception e) {
			LOGGER.error(e.toString());
			e.printStackTrace();
		}
		return map;
	}

}
